const zyc = {
    isArray(obj) {
        if (typeof Array.isArray === "function") return Array.isArray(obj);
        return Object.prototype.toString.call(obj) === "[object Array]";
    },

    isEmpty(obj) {
        if (obj === undefined) return true;
        if (typeof obj == "string" && obj == "") return true;
        if (typeof obj == "function") return false;
        if (zyc.isArray(obj)) return obj.length == 0;
        if (typeof obj == "object") {
            var n = 0;
            for (var p in obj) {
                if (p) {
                    n++;
                }
            }
            return n == 0;
        }
        return false;
    },

    isValidMobile(s) {
        var reg = /^[1][3,4,5,7,8][0-9]{9}$/;
        return reg.test(s);
    },

    // 时间处理
    handleTime(time) {
        let date = new Date(time),
            Y = date.getFullYear(),
            M = date.getMonth() + 1,
            D = date.getDate()
        if (M < 10) {
            M = "0" + M
        }
        if (D < 10) {
            D = "0" + D
        }
        return `${Y}年${M}月${D}日 ${time.substring(10)}`
    }
};

export default zyc;